<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>分类</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    <style>
        body {
            background-color: #fff;
        }

        .aui-bar-nav {
            /*padding: 0 11px 0 13px;
            box-sizing: border-box;*/
            top: 0;
            line-height: 2.25rem;
            background-color: #fff;
            color: #ffffff;
            border: none;
            background-size: 100% 1px;
            background-repeat: no-repeat;
            background-position: bottom;
            background-image: linear-gradient(0, #EEEEEE, #EEEEEE 50%, transparent 50%);
            background-image: -webkit-linear-gradient(90deg, #EEEEEE, #EEEEEE 50%, transparent 50%);
        }

        .aui-bar-nav .aui-btn .aui-iconfont {
            font-size: 0.9rem;
            line-height: 1.25rem;
            padding: 0;
            margin: 0;
            color: #000000;
        }

        .aui-bar-nav .aui-title {
            min-height: 2.25rem;
            position: absolute;
            margin: 0;
            text-align: center;
            white-space: nowrap;
            right: 5rem;
            left: 5rem;
            width: auto;
            overflow: hidden;
            text-overflow: ellipsis;
            z-index: 2;
            color: #333333;
            font-size: 17px;
            font-weight: 600;
        }

        .aui-btn span {
            width: 22px;
            height: 22px;
        }

        .aui-btn span img {
            width: 22px;
            height: 22px;
        }

        .aui-bar-nav .aui-pull-right {
            padding: 0 11px;
            font-size: 0.8rem;
            font-weight: 400;
            z-index: 2;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-align-items: center;
            align-items: center;
        }

        button,
        .aui-btn {
            position: relative;
            display: inline-block;
            font-size: 0.7rem;
            font-weight: 400;
            font-family: inherit;
            text-decoration: none;
            text-align: center;
            margin: 0;
            background: #dddddd;
            padding: 0 15px!important;
            height: 1.5rem;
            line-height: 1.5rem;
            border-radius: 0.2rem;
            white-space: nowrap;
            text-overflow: ellipsis;
            vertical-align: middle;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            -webkit-user-select: none;
            user-select: none;
        }

        .aui-pull-right {
            font-size: 15px;
            color: #222222!important;
            text-align: right;
        }

        .answer-title {
            width: 100%;
            min-height: 45px;
            display: flex;
            justify-content: space-around;
            align-items: center;
            font-family: PingFangSC-Regular;
            font-size: 14px;
            color: #666666;
            letter-spacing: 0;
            text-align: center;
            background: #FFFFFF;
            box-shadow: 0 1px 5px 0 rgba(221, 221, 221, 0.24);
            position: relative;
        }

        .answer-left,
        .answer-right {
            width: 100%;
            height: 45px;
            line-height: 45px;
        }

        .answer-title .active {
            font-family: PingFangSC-Medium;
            font-size: 14px;
            color: #222222;
            letter-spacing: 0;
            text-align: center;
            font-weight: bold;
            position: relative;
        }

        .answer-title .active:after {
            content: '';
            width: 20px;
            height: 3px;
            position: absolute;
            bottom: 0;
            right: 45%;
            background: #FF9014;
            border-radius: 1.5px;
            border-radius: 1.5px;
        }

        .sort {
            width: 100%;
            height: 50px;
            margin-top: 10px;
            background-color: #fff;
        }

        .sort .sort_select {
            width: 25%;
            float: left;
            line-height: 50px;
            font-size: 14px;
            font-family: PingFang SC;
            font-weight: 500;
            color: #333333;
            text-align: center;
        }

        .sort .sort_select span {
            display: inline-block;
        }

        .sort .sort_select span.selected {
            width: 18px;
            height: 18px;
            margin-top: 16px;
        }

        .sort .sort_select span:last-child {
            margin-left: 5px;
        }

        .sort .sort_select span.icon {
            width: 6.5px;
            height: 10px;
            margin-top: 20px;
        }

        .sort .sort_select span.icon img {
            width: 100%;
            height: 100%;
            display: block;
        }

        .sort_top {
            width: 100%;
            height: 50px;
            background-color: #fff;
            position: fixed;
            top: 0;
        }

        .sort_top .sort_select {
            width: 25%;
            float: left;
            line-height: 50px;
            font-size: 14px;
            font-family: PingFang SC;
            font-weight: 500;
            color: #333333;
            text-align: center;
        }

        .sort_top .sort_select span {
            display: inline-block;
        }

        .sort_top .sort_select span.selected {
            width: 18px;
            height: 18px;
            margin-top: 16px;
        }

        .sort_top .sort_select span:last-child {
            margin-left: 5px;
        }

        .sort_top .sort_select span.icon {
            width: 6.5px;
            height: 10px;
            margin-top: 20px;
        }

        .sort_top .sort_select span.icon img {
            width: 100%;
            height: 100%;
            display: block;
        }

        .active {
            color: #FF4141!important;
            font-weight: bolder;
        }

        [v-cloak] {
            display: none!important;
        }
    </style>
</head>

<body>
    <div id="app">
        <div id="header">
            <header class="aui-bar aui-bar-nav">
                <a class="aui-pull-left aui-btn" tapmode onclick="closeWin()">
                    <span>
                   <img src="../../image/back_arrow.png" alt="">
                </span>
                </a>
                <div class="aui-title">{{title}}</div>
            </header>
            <div class="sort">
                <div class="sort_select active" @click='changeIndex(1)' id="goodspersons">人气</div>
                <div class="sort_select" @click='changeIndex(2)' id="goodnews">最新</div>
                <div class="sort_select" @click='changeIndex(3)' id="goodsales">销量</div>
                <div class="sort_select" @click='changeIndex(4)'>
                    <span id="goodPrice">价格</span>
                    <span class="icon" v-if='isPriceicon==0'><img src="../../image/sort.svg" alt=""></span>
                    <span class="icon" v-if='isPriceicon==1'><img src="../../image/asce.svg" alt=""></span>
                    <span class="icon" v-if='isPriceicon==2'><img src="../../image/desc.svg" alt=""></span>
                </div>
            </div>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/vue.js"></script>
<script type="text/javascript" src="../../script/cling.js"></script>
<script type="text/javascript" src="../../script/fastclick.js"></script>
<script type="text/javascript">
    apiready = function() {
        FastClick.attach(document.body);
        cl.apiready();
        cl.openFrame({
            name: './classify_list_frame',
            header: header,
            bounces: true,
            bgColor: '#FAF9F9',
            pageParam: {
                cid: api.pageParam.cid
            }
        });
        vm.title = api.pageParam.title;

    }
    var vm = new Vue({
        el: "#header",
        data: {
            title: '',
            isPriceicon: 0,
            isflag: true
        },
        methods:{
          changeIndex: function(index) {
              if (index == 1) {
                  vm.isPriceicon = 0;
                  vm.isflag = true;
                  $api.removeCls($api.byId('goodPrice'), 'active');
                  $api.removeCls($api.byId('goodsales'), 'active');
                  $api.removeCls($api.byId('goodnews'), 'active');
                  $api.addCls($api.byId('goodspersons'), 'active');
                  api.sendEvent({
                      name: 'queryClassify',
                      extra: {
                          value:0
                      }
                  });


              }
              if (index == 2) {
                  vm.isPriceicon = 0;
                  vm.isflag = true;
                  vm.sort = 1;
                  api.sendEvent({
                      name: 'queryClassify',
                      extra: {
                          value:1
                      }
                  });
                  $api.removeCls($api.byId('goodPrice'), 'active');
                  $api.removeCls($api.byId('goodsales'), 'active');
                  $api.addCls($api.byId('goodnews'), 'active');
                  $api.removeCls($api.byId('goodspersons'), 'active');
              }
              if (index == 3) {
                  vm.isPriceicon = 0;
                  vm.isflag = true;
                  api.sendEvent({
                      name: 'queryClassify',
                      extra: {
                          value:2
                      }
                  });
                  $api.addCls($api.byId('goodsales'), 'active');
                  $api.removeCls($api.byId('goodPrice'), 'active');
                  $api.removeCls($api.byId('goodnews'), 'active');
                  $api.removeCls($api.byId('goodspersons'), 'active');

              }
              if (index == 4) {
                  vm.isPriceicon = 1;
                  if (vm.isflag) {
                      vm.isPriceicon = 1;
                      vm.isflag = false;
                      api.sendEvent({
                          name: 'queryClassify',
                          extra: {
                              value:5
                          }
                      });
                  } else {
                      vm.isPriceicon = 2;
                      vm.isflag = true;
                      api.sendEvent({
                          name: 'queryClassify',
                          extra: {
                              value:6
                          }
                      });
                  }
                  $api.addCls($api.byId('goodPrice'), 'active');
                  $api.removeCls($api.byId('goodsales'), 'active');
                  $api.removeCls($api.byId('goodnews'), 'active');
                  $api.removeCls($api.byId('goodspersons'), 'active');

              }

          }
        }
    })

    function closeWin() {
        cl.closeWin({
            name: 'classify_list'
        })
    };
</script>

</html>
